<?php require_once(APP.'libs'.DS.'system_properties.php');?>
<?php require_once(APP.'libs'.DS.'util.php');;?>
<script type="text/javascript" src="<?php echo SystemProperties::$app_host_webroot;?>/js/select_date.js"></script>
<script type="text/javascript">

</script>
<style type="text/css">
.navi div a ,.navi div b{
display:block;
padding-right:30px;
float:left;
}
</style>
<table width="100%" border="0" cellspacing="1"  cellpadding="0" class="navi">
  <tr>
  <td>
  <form action="" method="GET" style="padding:0;margin:0;">
  <b>搜索：</b>
  用户名、昵称或用户ID： <input type="text" name="kw" />
  <input type="hidden" name="list_type" value="0" />
  <input type="submit" value="搜索" />
  </form>
  </td>
  </tr>
</table>
<br />
<table width="100%" border="0" cellspacing="1"  cellpadding="0" class="navi">
  <tr>
  <td>
  <div>
  <?php foreach ($types as $type => $name) { ?>
    <?php if ($type == $list_type) { ?>
        <b style="color:red"><?=$type?>、<?=$name?> </b>
    <?php } else { ?>
        <a href="<?php echo SystemProperties::$app_host;?>/user/manageLuck/<?=$type?>">
        <?=$type?>、<?=$name?> 
        </a>
    <?php } ?>
  <?php } ?>
  </div>

  
    </td>
    
  </tr>
  <tr>
  <td>
  <form action="" method="GET" style="padding:0;margin:0;">
  <b>下载Excel：</b>
  <input type="hidden" name="list_type" value="<?=$list_type?>" />
  <input type="hidden" name="download" value="1" />
  下载该类别数据，
  起始时间:<input name="from" readonly type="text" value="" size="15" onFocus="CalendarWebControl.show(this,false,this.value);">  
  结束时间:<input name="end" readonly type="text" value="" size="15" onFocus="CalendarWebControl.show(this,false,this.value);">  
  <input class="comment_btn_Submit" type="submit" value="下载" /> (点击后请稍等，请不要重复刷新，不要选择时间跨度太大)</td>
  </form>
  </td>
  </tr>
  </table>


<br /><br /><br />
  <?=$pager ?>
  <form action="<?=SystemProperties::$app_host?>/user/manageLuckSubmit" method="POST">
  <input type="submit" name="x" value="提交所有操作" style="width:200px;height:38px;margin-left:20px;"><br /><br />
  <input type="hidden" name="list_type" value="<?=$list_type?>" />
  <input type="hidden" name="list_order" value="<?=$list_order?>" />
  <input type="hidden" name="page" value="<?=$page?>" />
<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
  <tr>
    <td  align="center" width="50">序列号</td>
    <td  align="center" width="100">产品信息</td>
    <td  align="center" width="210">用户信息</td>
    <td  align="center">快递情况及处理</td>
    <td  align="center">分享情况及处理</td>
    <?php if ($list_type == 7 || $list_type == 0) { ?>
    <td  align="center">未领取原因</td>
    <?php } ?>
  </tr>
  <?php if (!empty($data)) foreach ($data as $da) { 
      $l = $da['g_lucks'];
      $u = $da['g_users'];
      $p = $da['g_lucks']['product_info'];
      ?>
  <tr>
  <td><?=$l['seqid']?></td>
  <td width="100">
  <b><?=$l['how_get']=='zhuan'?'[赚宝]':'[兑换]'?></b><br />
  <img width="90" height="90" src="<?=SystemProperties::$path.$p['g_img']?>" /><br />
  <a href="<?=($l['how_get']=='zhuan')?SystemProperties::get_product_url($l['pid']):SystemProperties::get_convert_url($l['pid'])?>" target="_blank">
  <?=$p['g_name']?><br />
  </a>
  <br />
  申请日期:<br /><?=date('Y-m-d',strtotime($l['time']))?><br />
  <?php if ($l['kuaidi_type'] != '-') { ?>
  申请快递日期:<br /><b><?=date('Y-m-d',strtotime($l['kuaidi_request_time']))?></b><br />
  <?php } ?>

  </td>
  <td>
  <br /><br /><br />
  <table cellpadding="0" cellspacing="0" style="border:0px" border="0">
  <tr><td width="80"><b>昵称:</b></td><td width="130"><a href="<?=SystemProperties::get_profile_url($u['g_uid'])?>" target="_blank"><?=$u['g_name']?></a></td></tr>
  <tr><td><b>活跃天数:</b></td><td><?=$u['g_active_day']?>&nbsp;</td></tr>
  <tr><td><b>真实姓名:</b></td><td><?=$u['g_realname']?>&nbsp;</td></tr>
  <tr><td><b>手机:</b></td><td><?=$u['g_phone']?>&nbsp;</td></tr>
  <tr><td><b>地址:</b></td><td><?=$u['g_address']?>&nbsp;</td></tr>
  <tr><td><b>邮编:</b></td><td><?=$u['g_zipcode']?>&nbsp;</td></tr>
  <tr><td><b>身份证:</b></td><td><?=$u['g_idcard']?>&nbsp;</td></tr>
  <tr><td><b>年龄:</b></td><td><?=Util::getAgeFromID($u['g_idcard'])?>&nbsp;</td></tr>
  </table>
  <br /><br /><br />
  </td>
  <td>
  <?php 
      switch ($l['type']) {
          case 'guitai':echo '柜台取货';break;
          case 'shangjiafahuo':echo '商家发货';break;
          case 'coupon':echo '优惠券';break;
      }
      $kuaidi_list = array(
      '速尔快递:','中通快递:'
      );
  
  if ($l['kuaidi_type'] != '-' && in_array($list_type,array(0,1,2,3)) && $l['type']=='kuaidi') { ?>
      快递方式：<b><?=$l['kuaidi_type']=='daofu'?'到付':'自取'?></b><br />
      快递状态：<b><?=($l['admin_is_sent']=='y')?'已发货':'未发'?></b><br />
      <br /><br /><br />
      <b style="color:red">更新状态</b>：<br />
      <label><input type="radio" name="send_<?=$l['seqid']?>_<?=$l['uid']?>" value="n" <?=($l['admin_is_sent']=='n')?'checked="checked"':''?>>未发</label><br />
      <label><input type="radio" name="send_<?=$l['seqid']?>_<?=$l['uid']?>" value="y" <?=($l['admin_is_sent']=='y')?'checked="checked"':''?>>已发货</label><br />
      快递单号：<br />
      <?php foreach ($kuaidi_list as $kuaidi ) { ?>
      <label><input type="radio" name="expresstype_<?=$l['seqid']?>_<?=$l['uid']?>" value="<?=$kuaidi?>" <?php if (strstr($l['admin_express_sn'], $kuaidi)) { echo 'checked="checked"'; }?>><?=$kuaidi?></label><br />
      <?php } ?>
      <input type="text" name="express_<?=$l['seqid']?>_<?=$l['uid']?>" value="<?=str_replace($kuaidi_list, '', $l['admin_express_sn'])?>" />
      <br />
  <?php } else {?>
  <br /><span style="color:#888"><?=$l['type']=='kuaidi'?'未申请':'无需快递'?></span>
  <?php } ?>
  
  </td>
  <td width="200">
  <?php if ($l['is_share'] != 'n' && in_array($list_type,array(0,4,5,6)) ) { ?>
      <?php if (!empty($l['share_detail']['photo'])) { ?>
      <img src="<?=SystemProperties::$path_webroot?>/userpic/<?=$l['share_detail']['photo']?>" width="200">
      <?php } ?>
      <b>分享内容</b>:<?=$l['share_detail']['content']?><br />
      <b>分享时间</b>:<?=date('Y-m-d H:i:s',strtotime($l['share_time']))?><br />
      <br /><br /><br />
      <input type="hidden" name="oldshare_<?=$l['seqid']?>_<?=$l['uid']?>" value="<?=$l['is_share']?>" />
      <b style="color:red">审核状态</b>：<br />
      <label><input type="radio" name="share_<?=$l['seqid']?>_<?=$l['uid']?>" value="pass" <?=($l['is_share']=='pass')?'checked="checked"':''?>>通过</label><br />
      <label><input type="radio" name="share_<?=$l['seqid']?>_<?=$l['uid']?>" value="unpass" <?=($l['is_share']=='unpass')?'checked="checked"':''?>>不通过</label><br />
      <br />
  <?php } else {?>
    <span style="color:#888">未分享</span>
  <?php }?>
  </td>
      <?php if ($list_type == 7|| $list_type == 0) { ?>
    <td><?=$l['why_not_get']?></td>
    <?php } ?>
  </tr>
  <?php } ?>
  </table>
  <br /><br />
  <input type="submit" name="x" value="提交所有操作" style="width:200px;height:38px;margin-left:20px;">
  </form>
  <?=$pager ?>
 